package com.liu.staticProxyDemo_1_1_version;

import com.liu.staticProxyDemo_1_0_version.ManToolsFactory;
//新加一个不同类型的客户(客户由男人变成了女人)的需求
//代理对象zhangsan, 包含正是对象为真实对象进行增强，和真实对象继承同一个接口
public class Zhangsan implements ManToolsFactory, WomanToolsFactory {
    public ManToolsFactory factory1;

    public WomanToolsFactory factory2;
// 通过构造方法从外界传递代理对象
    public Zhangsan(ManToolsFactory factory1, WomanToolsFactory factory2) {
        super();
        this.factory1 = factory1;
        this.factory2 = factory2;
    }

    public Zhangsan(ManToolsFactory factory1) {
        this.factory1 = factory1;
    }

    public Zhangsan(WomanToolsFactory factory2) {
        this.factory2 = factory2;
    }

    @Override
    public void saleManTools(String size) {
        this.dosomeThingBefore();
        factory1.saleManTools(size);
        this.dosomeThingEnd();
    }

    @Override
    public void saleWomanToos(float heigh) {
        this.dosomeThingBefore();
        factory2.saleWomanToos(heigh);
        this.dosomeThingEnd();


    }

    //售后服务 (前置增强)
    private void dosomeThingEnd(){
        System.out.println("精美包装,一条龙服务！");
        System.out.println("-----------------------------------");
    }
    //    售前服务(前置增强)
    private void dosomeThingBefore(){

        System.out.println("根据您的需求，进行合理推荐一款合适您的产品");

    }




}
